
#ifndef DD_ImgCapPlugDefine_H_
#define DD_ImgCapPlugDefine_H_

#include "DD_CapCfg.h"
#include "DD_ImgCfg.h"
#include "DD_CapCfg2.h"

#include "DDErrorDefine.h"
#include "DDSafeDelete.h"
#include "DDAutoDelete.h"

class ImgCapPlug
{
public:
	ImgCapPlug()
	{
	}
	virtual ~ImgCapPlug()
	{
	}

public: 
	//get this plug description
	virtual int GetPlugDescription( zkCapDevDesc *pDescs,int &nCount ) = 0;
	virtual int SelectCap( zkCapDevDesc *pDesc ) = 0;

public:
	//must init
	virtual int Initialize() = 0;
	//
	virtual int SetHwnd(HWND hWnd) = 0;
	//
	virtual int RegOnDrawCallBack(OnDrawCallBackFun funCallBack,void *pContext) = 0;

	//set capture parameter
	virtual int OpCaptureParam(void *pVoid = NULL) = 0;
	//
	virtual int GetImageSize(int &nWidth,int &nHeight){return 0;}
	//
	virtual int GetImageInfo(zkImgBitInfo **ppImgBitInfo) = 0;

	//
	virtual int StartCapture() = 0;
	//stop active
	virtual int StopCapture() = 0;
    //
	virtual int	Draw(void *pVoid = NULL) = 0;
     

	//mustn't delete ppBitInfo and ppData
	virtual int GetImageData( zkImgBitInfo **ppImgBitInfo ) = 0;

	//get live Histogram Info
	virtual int GetLiveHistogramInfo(void **ppHistogram) = 0;
	//
	virtual int GetGrayValue(int x,int y,DWORD &dwGray) = 0;

public:
	virtual int SelectBadPixelFile(char *pFileName) = 0;
	//select revise file
	virtual int SelectReviseFile(char *pFileName,int nCreateRevise = 0) = 0;

public:
	//
	virtual int CreateBadPixelRevise(void *pVoid=NULL)  = 0;
	virtual int SetBadPixelReviseGrade(int nGrade)      = 0;
	virtual int SaveBadPixelReviseFile(char *pFileName) = 0;
	//dwValue: 0-normal,>0 bad pixel
	virtual int GetBadPixelValue(int x,int y,DWORD &dwValue) = 0;
	virtual int SetBadPixelValue(int x,int y,DWORD dwValue)  = 0;

public:
	//create revise
	virtual int CreateRevise(void *pVoid=NULL) = 0;
	virtual int SetReviseGrade(int nGrade) = 0;
	virtual int SaveReviseFile(char *pFileName) = 0;

public:
	virtual int SetRecordParam(void *pVoid = NULL) = 0;
	virtual int StartRecord(char *pFileName) = 0;
	virtual int StopRecord() = 0;
 
};

//create plug interface,you must delete it 
#ifdef DDCAP_EXPORTS
#define DDCapPlug_API extern "C"  __declspec(dllexport) 
#else 
#define DDCapPlug_API extern "C"  __declspec(dllimport) 
#endif
//DDCapPlug_API int __stdcall CreatePlugMan(ImgCapPlug **ppPlug);
DDCapPlug_API int CreatePlugMan(ImgCapPlug **ppPlug);
typedef int (__cdecl * LPOPCREATEPLUGMAN)(ImgCapPlug **ppPlug);

#endif